﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using RBS.Web.API.Models;
using RBSModel=RBS.Core.Model;
namespace RBS.Web.API.Areas.Order.Controllers
{
    /// <summary>
    /// 订单跟踪状态
    /// </summary>
    public class OperateRecordController : ApiController
    {
        private ApiContext _db = new ApiContext();
        // POST api/operaterecord
        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        public JsonData Post([FromBody] RBSModel.D_OperateRecord model)
        {
          var jsonData = new JsonData { Success = true };
            if (ModelState.IsValid)
            {
                model.OperateDate = DateTime.Now;
                var item = _db.OperateRecord.Add(model);
                _db.SaveChanges();
                jsonData.Data = item.Id; 
                return jsonData;
            }
            else
            {
                jsonData.Success = false;
                jsonData.Error = Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState).ToString();
                return jsonData;
            }
        }

        
       
    }
}
